package com.nijie.library.controller.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nijie.library.POJO.Message;
import com.nijie.library.POJO.modelPOJO.Menu;
import com.nijie.library.service.sys.SysMenuSvc;

@Controller
@RequestMapping("sys")
public class SysMenuCtrl {
	@Autowired
    private SysMenuSvc sysMenuSvc;
	@RequestMapping("menu")
	public String page(){
		return "views/sys/menu";
	}
	@RequestMapping("getMenu")
	@ResponseBody
	public List<Menu>  getMenu(Menu menu){
		return sysMenuSvc.get(menu);
	}
	@RequestMapping("update")
	@ResponseBody
	public Message<Menu> update(Menu menu) {
		Message<Menu> message = new Message<>();
		menu.setStatus("1");
		message = sysMenuSvc.modify(menu);
		return message ;
	}
	@RequestMapping("insert")
	@ResponseBody
	public Message<Menu> insert(Menu menu) {
		Message<Menu> message = new Message<>();
		menu.setStatus("1");	
		message = sysMenuSvc.save(menu);
		return message;
	}
	@RequestMapping("modifyStatus")
	@ResponseBody
	public Message<Menu> modifyStatus(String ids,String status) {
		Message<Menu> message = new Message<>();
		message = sysMenuSvc.modifyStatus(ids, status);
		return message;
	}
}
